package algorithm.recursion.test;

import algorithm.recursion.basic.Fibonacci;
import algorithm.recursion.basic.Hanoi;
import algorithm.recursion.basic.TailCall;
import utility.Times;

/**
 * 项目名称: god
 * 包 名 称: algorithm.recursion.test
 * 类 名 称: Main
 * 类 描 述: TODO
 * 创建时间: 2020/7/7 10:32 下午
 * 创 建 人: Justice
 */
public class Main {
    public static void main(String[] args) {
        testFibonacci();
        // testHanoi();
    }

    public static void testFibonacci() {
        int n = 10;
        Times.check("fib0", () -> {
            System.out.println(Fibonacci.fib0(n));
        });
        Times.check("fib1", () -> {
            System.out.println(Fibonacci.fib1(n));
        });
        Times.check("fib2", () -> {
            System.out.println(Fibonacci.fib2(n));
        });
        Times.check("fib3", () -> {
            System.out.println(Fibonacci.fib3(n));
        });
        Times.check("fib",()->{
            System.out.println(TailCall.fib(n));
        });
    }

    public static void testHanoi() {
        Hanoi.hanoi(3, "A", "B", "C");
    }
}
